<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no" />
  <title>PDF转WORD</title>
  <!--标准mui.css-->
  <link rel="stylesheet" href="../css/mui.min.css">
  <script src="../js/mui.min.js"></script>
  <!--App自定义的css-->
  <link rel="stylesheet" type="text/css" href="../css/app.css" />
  <link rel="stylesheet" href="../npl/css/vant.mini.css" />
  <script src="../js/vue.js"></script>
  <script src="./cellBtns/index.js" type="text/javascript" charset="utf-8"></script>
  <link rel="stylesheet" href="./cellBtns/css.css">
  <script src="../js/jquery-3.6.0.min.js"></script>
  <script src="../js/vconsole.min.js"></script>
  <script src="../js/sm2.js"></script>
  <script src="../js/sm3.js"></script>
  <script src="../js/feedback.js"></script>
  <script src="../js/clipboard.js"></script>
  <script src="../js/flexible.js"></script>
  <script src="../npl/js/vant.mini.js"></script>
  <script src="../js/elementui.js"></script>
  <link rel="stylesheet" href="../css/elementui.css">
  <script src="./text.js" type="text/javascript"></script>
  <style>
    html,
    body,
    #app {
      background: none !important;
    }

    #app {
      width: 100%;
      height: 100%;
      overflow: hidden;
    }

    .trainTicketstitle {
      /* background-image: linear-gradient(to right, rgb(13, 121, 131), rgb(25, 179, 182)); */
      /* padding: 0rem 0.2rem; */
      color: #fff;
      height: 1rem;
      font-size: 0.35rem;
      z-index: 99999 !important;
    }

    .mui-btn-blue,
    .mui-btn-primary,
    input[type=submit] {
      background-color: rgb(25, 179, 182);
      color: #fff;
      border: 1px solid rgb(25, 179, 182);
      border-radius: 4px;
      margin-right: 10px;
    }

    .mui-toast-container {
      top: 50%;
    }

    ::-webkit-input-placeholder {
      color: black;
    }

    .mui-pull-left {
      color: #fff;
    }

    .left {
      text-align: center;
    }

    .left b {
      line-height: 0.5rem;
      color: #fff;
    }

    .left .left1 {
      position: absolute;
      left: 0.1rem;
      top: 0.25rem;
    }

    .left_title {
      line-height: 0.5rem;
      color: #fff;
      font-weight: 600;
    }

    .List {
      height: calc(100% - 3rem) !important;
      height: calc(100% - 3rem - constant(safe-area-inset-bottom));
      height: calc(100% - 3rem -env(safe-area-inset-bottom));
      border-radius: .2rem;
      padding: 0 10px;
      overflow-y: scroll;
    }

    #openFile {
      background: none !important;
      /* position: absolute; */
      font-weight: 500;
      color: #5f84f7;
      font-size: 11px;
      /* width: 20%; */
      height: 100%;
      top: 0;
      right: 0rem;
      padding: 0;
      border: none;
    }

    .uplode {
      width: 100%;
      padding: 0 20px;
    }

    .uplode_img {
      width: 1rem;
      float: right;
      height: 1rem;
    }

    /* #form-user{
            width: 100%;
            float: right;
            height: 100%;
        } */
    .form-user {
      width: 100%;
      height: 100%;
      position: relative;
    }

    .uplode_img img {
      width: 100%;
      height: 100%;
    }

    .wrpper {
      /* width: 34px; */
      height: 64px;
      display: flex;
      justify-content: space-between;
      position: relative;
      align-items: center;
    }

    .List_wrapper .List_access {
      /* width: 1.5rem; */
      height: 16px;
      margin-left: 3px;
      line-height: 16px;
      background-color: rgba(95, 132, 247, 0.08);
      border-radius: 18px;
      font-family: PingFang SC;
      color: #2d343c;
      font-size: 10px;
      padding: 0 5px;
      /* border-right: 1px solid #ccc; */
      color: rgb(199, 197, 197);
      /* left: 55%;
    top: -2% */
      float: left;
    }

    .List_wrapper .List_time {
      height: 16px;
      line-height: 16px;
      background-color: rgba(95, 132, 247, 0.08);
      border-radius: 18px;
      font-family: PingFang SC;
      color: #2d343c;
      font-size: 10px;
      padding: 0 5px;
      /* position: absolute; */
      float: left;
      display: flex;
      align-items: center;
      justify-content: space-between;
      /* border-right: 1px solid #ccc; */
      color: rgb(199, 197, 197);
      font-size: 13px;
      left: 0%;
      top: 0%
    }

    .List_wrapper {
      height: 16px;
      width: 200px;
      line-height: 16px;
      position: absolute;
      left: 13%;
      top: 58%
    }

    .List_wrapper1 {
      height: 16px;
      width: 85%;
      line-height: 16px;
      position: absolute;
      left: 17%;
      top: 48%
    }

    .List_img img {
      width: 100%;
      height: 100%;
    }

    .List_img {
      width: .7rem;
      height: .7rem;
      margin-right: 15px;
    }


    .van-cell {
      padding: 0 10px !important;
      background: none !important;
    }

    #multipartFile1 {
      width: 100%;
      height: 100%;
      position: absolute;
      opacity: 0;
      left: 0;
      top: 0;
      z-index: 999;
    }

    .form_btn {
      width: 100%;
      display: flex;
      padding: 0 5%;
      justify-content: space-between;
    }

    .form_btn .qx {
      width: 47%;
      background-color: rgba(45, 52, 60, 0.08);
      border-radius: 48px;
      font-family: PingFang SC;
      color: rgba(45, 52, 60, 0.8);
    }

    .form_btn .tj {
      width: 47%;
      background-color: #5f84f7;
      color: #fff;
      border-radius: 48px;
    }

    .van-popup--center {
      border-radius: 12px;
      width: 100%;
      padding: 20px 10px;
      display: flex;
      justify-content: space-around;
      flex-direction: column;
      height: 61%;
    }

    .van-cell {
      align-items: center;
      padding: 10px 2px 10px 5px;
      justify-content: space-between;
    }

    .popWrapper {
      width: 100%;
      height: 100%;
      justify-content: center;
      align-items: center;
      display: flex;
      flex-direction: column;
      padding: 0 24px;
    }

    .fileImg {
      width: 100%;
      flex: 1;
      display: flex;
      flex-direction: column;
      padding: 24px 0 0 10px;
    }

    .pop_title {
      font-family: PingFang SC;
      font-weight: bold;
      color: #2d343c;
      font-size: 16px;
    }

    .upload_img {
      width: 100%;
      background: url("../image/bg-2.png") no-repeat;
      background-size: 100% 100%;
    }

    .form_wrapper {
      display: flex;
      width: 100%;
      height: 4rem;
      justify-content: center;
      align-items: center;
      flex-direction: column;
    }

    .form_img {
      /* width: 100%;
      height: 38%; */
      text-align: center;
      padding: 20px 60px;
      box-sizing: border-box;
    }

    .form_img img {
      width: 100%;
      height: 100%;
    }

    .form_text {
      font-weight: 500;
      margin-top: 4px;
      color: rgba(45, 52, 60, 0.6);
      font-size: 12px;
    }

    .flowPath {
      width: 100%;
      flex: 1;
    }

    .wrpper {
      /* width: 34px; */
      height: 64px;
      display: flex;
      justify-content: space-between;
      position: relative;
      align-items: center;
    }

    .List_img img {
      width: 100%;
      height: 100%;
    }

    .List_img {
      width: .7rem;
      height: .7rem;
      /* position: absolute; */
      /* left: 0;
    top: 6% */
    }

    .List_title1 {
      width: 70%;
      height: .5rem;
      line-height: .5rem;
      position: absolute;
      font-family: PingFang SC;
      font-weight: 500;
      color: #2d343c;
      font-size: 13px;
      left: 16%;
      top: 13%
    }

    .List_title {
      width: 70%;
      height: .5rem;
      line-height: .5rem;
      position: absolute;
      font-family: PingFang SC;
      font-weight: 500;
      color: #2d343c;
      font-size: 13px;
      left: 13%;
      top: 13%
    }

    .van-overlay,
    .van-popup {
      background: none !important;
    }

    .van-overlay {
      z-index: 0 !important;
    }

    .numImg {
      display: flex;
      margin-top: 10px;
      color: #999;
      font-size: 12px;
      margin-left: 10px;
    }

    .text_title {
      /* height: 30px; */
      /* padding: 0% 0% 0% 4%; */
      position: relative;
      /* border-bottom: 1px solid #8a9dbe; */
      /* background:turquoise; */
      /* line-height: 30px;         */
    }

    .first_span {
      width: 3px;
      border-radius: 20% 20%;
      display: inline-block;
      height: 15px;
      background: #EA8332;
    }

    .first_span_text {
      font-weight: 500;
      font-size: 15px;
      color: #1e3754;
      /* position: absolute;
      left: 6%;
      top: 9%; */
    }

    .first_span_img {
      /* position: absolute;
        left: 25%;
        top: 36%; */
      margin-left: 3px;
      color: red;
    }

    .curtain {
      z-index: 9999 !important;
    }
  </style>
</head>

<body>
  <div id="app" style="background-image: url('../image/Back.png');" v-cloak>
    <div class="is-loading">
      <div class="is-loading">
        <div class="curtain">
          <div class="loadingBgc">
            <div class="loader"></div>
          </div>
        </div>
      </div>
    </div>
    </van-button>
    <div style="margin-bottom: .3rem" class='trainTickets'>
      <div class='trainTicketstitle'>
        <div class="header_tit">
          <van-nav-bar title="转一转" left-arrow>
            <template #left>
              <div class="back_l" @click="home"><img src="../image/left.png" alt=""></div>
            </template>
            <!-- <template #right>
                            <div class="back_r" @click="close"><img src="../image/del.png" alt=""></div>
                        </template> -->
          </van-nav-bar>
        </div>
      </div>
    </div>

    <!-- <van-popup :close-on-click-overlay="false" v-model="showFile"> -->

    <div class="popWrapper">
      <div style="width: 100%;">
        <div class="text_title">
          <span class="first_span" style="margin-top: 5px"></span>
          <span class="first_span_text"><span>上传PDF</span><span class="first_span_img">*</span></br> <span
              class="numImg">上传PDF文件大小不超过40M，转成WORD文件后直接发送到邮箱</span>
          </span>
        </div>
      </div>
      <div class="fileImg">
        <div class="upload_img">
          <form class="form-user">
            <div class="form_wrapper" @click="getEmil">
              <!-- <div class="form_img">
                  <img src="../image/bg-1.png" alt="">
                </div> -->
              <!-- <p class="form_text">点击此处上传文件</p> -->

            </div>
          </form>
        </div>
        <!-- <div class="flowPath" v-if="progressBar">
            <div class="wrpper">
              <div class="List_img"><img src="../image/voice.png" alt=""></div>
              <div class="List_title1">{{fileName | fileNametext}}</div>
              <div class="List_wrapper1">
                <el-progress :stroke-width="3" :percentage="progress"></el-progress>
              </div>
            </div>
          </div> -->
      </div>
    </div>
    <!-- </van-popup> -->

  </div>
  <script>
    new Vue({
      el: "#app",
      data() {
        return {
          loading: false,
          finished: false,
          listData: [],
          num: 0,
          disabled: false,
          showFile: true,
          filesPdfName: '',
          filesPdfSize: '',
          // 设置每个分片的大小（字节）
          CHUNK_SIZE: 5 * 1024 * 1024 + "", // 1MB
          // 分片上传成功索引
          succeed: [],
          // 分片上传失败索引
          failed: [],
          currentRate: 0,
          progress: 0,
          fileName: '',
          progressBar: false,
          disabledInp: false,
          isflageIOX: false,
          retryNum: 0,
          myindex: -1,
          formatList: ['pdf']
        }
      },
      filters: {
        textNum: (value) => {
          if (!value) return "";
          let data = value.split("");
          if (data.length < 15) {
            return value;
          }
          return value.slice(0, 15) + "...";
        },
        fileNametext: (value) => {
          if (!value) return "";
          let data = value.split("");
          if (data.length < 9) {
            return value;
          }
          return value.slice(0, 9) + "...";
        },

      },
      created() {
        const _this = this
        let jsApiList = []
        $.getScript("../js/jweixin-sgccigw-1.0.0.js" /*"js/jweixin-1.0.0.js"*/ , function () {
          'use strict';
          wx.ready(function () {
            wx.onHistoryBack(() => {
              _this.home()
              return false
            })
          });
          jsApiList = [
            'onHistoryBack',
          ];
          wx.config({
            beta: true, // 调用wx.invoke形式的接口值时，该值必须为true。
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: corpid,
            timestamp: '1626832073',
            nonceStr: nonceStr,
            signature: signature,
            jsApiList: jsApiList
          });
        });
      },
      mounted() {
        this.compatibleInput()
      },
      methods: {
        // 判断安卓还是ios
        compatibleInput() {
          //获取浏览器的userAgent,并转化为小写
          var ua = navigator.userAgent.toLowerCase();
          //判断是否是苹果手机，是则是true
          var isIos = ua.indexOf("iphone") != -1 || ua.indexOf("ipad") != -1;
          if (isIos) {
            this.isflageIOX = true;
          } else {
            this.isflageIOX = false;
          }
        },
        home() {
          $(location).attr("href", "Home.html");
        },
        getEmil() {
          let _this = this
          // if (_this.disabledInp) {
          //   mui.toast('正在上传文件...', {
          //     duration: 'long',
          //     type: 'div'
          //   })
          //   return
          // }
          userId = sessionStorage.getItem("userId");
          if (sessionStorage.getItem("iscp_port")) {
            iscp_port = sessionStorage.getItem("iscp_port");
          } else {
            iscp_port = ""
          }
          let data = {
            "userId": userId,
            "timestamp": new Date().getTime() + ""
          };
          data = JSON.stringify(data)
          let sign = sm3(data);
          let AuthenticationSession = sessionStorage.getItem("Authentication");
          $.ajax({
            url: localUrlLink + iscp_port + "/tjAiAssistant/email/isEmail",
            type: "post",
            async: false,
            dataType: "json",
            data: data,
            headers: {
              "Content-Type": "application/json;charset=UTF-8",
              Authentication: AuthenticationSession,
              sign: sign
            },
            success: (res, txt, xhr) => {
              if (sm3(res.resultValueStr) == xhr.getResponseHeader("sign")) {
                let Authentication = xhr.getResponseHeader("Authentication")
                if (res.code == 200) {
                  if (Authentication) {
                    sessionStorage.setItem("Authentication", Authentication);
                  }
                  _this.getFile()
                } else {
                  mui.toast('请前往“我的”页面设置内网邮箱！', {
                    duration: 'long',
                    type: 'div'
                  })
                }
              } else {
                mui.toast('完整性校验失败', {
                  duration: 'long',
                  type: 'div'
                })
              }
            },
            error: (e) => {
              // $(".curtainVoice").css("display", "none");
              mui.toast('请求异常,请稍后再试', {
                duration: 'long',
                type: 'div'
              })
            },
          });
        },
        getFile() {
          console.log(888)
          let _that = this
          wx.invoke("ext_FileBrowser_StartPreView", {}, function (res) {
            _that.channelId = "net_upload_" + _that.createNonceStr(8) + new Date().getTime() + "";
            // _that.progress = 0
            // wx.invoke("multiWindows_subscribe", {
            //   channelId: _that.channelId
            // }, function (res) {
            //   if (res.err_msg == "multiWindows_subscribe:ok") {
            //     var progress = Number(res.data.progress) >= 100 ? 99 : Number(res.data.progress)
            //     _that.progress = progress > _that.progress ? progress : _that.progress
            //   }
            // })

            console.log(res, 676767)
            if (_that.isflageIOX) {
              if (checkFileNameForSensitiveWords(res.name)) {
                mui.toast('检测到敏感内容，请确认后再试。', {
                  duration: 'long',
                  type: 'div'
                })
                return
              }
              if (Number(res.size) / 40000000 > 1) {
                mui.toast('上传文件大小不能大于40MB', {
                  duration: 'long',
                  type: 'div'
                })
                return
              }
              const suffix = res.name.split('.').reverse()[0]
              if (!_that.formatList.includes(suffix.toLocaleLowerCase())) {
                mui.toast('请选择PDF文件', {
                  duration: 'long',
                  type: 'div'
                })
                return
              }
              console.log("ios上传文件")
              _that.checkList(res.filePath, res.name, _that.channelId)
            } else {
              let recordArr = JSON.parse(res.result)
              const suffix = recordArr[0].name.split('.').reverse()[0]
              if (!_that.formatList.includes(suffix.toLocaleLowerCase())) {
                mui.toast('请选择PDF文件', {
                  duration: 'long',
                  type: 'div'
                })
                return
              }
              if (checkFileNameForSensitiveWords(recordArr[0].name)) {
                mui.toast('检测到敏感内容，请确认后再试。', {
                  duration: 'long',
                  type: 'div'
                })
                return
              }
              if (Number(recordArr[0].fileSize) / 40000000 > 1) {
                mui.toast('上传文件大小不能大于40MB', {
                  duration: 'long',
                  type: 'div'
                })
                return
              }
              _that.checkList(recordArr[0].path, recordArr[0].name, _that.channelId)
            }
          })
        },
        checkList(path, name, id, hash, index) {
          $(".curtain").css("display", "block");
          let that = this
          that.disabledInp = true
          that.progressBar = true
          let iscp_port
          if (sessionStorage.getItem("iscp_port")) {
            iscp_port = sessionStorage.getItem("iscp_port");
          } else {
            iscp_port = ""
          }
          let Authentication = sessionStorage.getItem("Authentication");
          const timestamp = new Date().getTime() + ""
          let userId = sessionStorage.getItem("userId");
          let sign = sm3(timestamp + "&" + userId)
          that.fileName = name
          wx.invoke("ext_Net_FragmentUpload", {
            data: {
              serverAddress: localUrlLink + iscp_port + `/tjAiAssistant/storage/splitUpload2?channelId=${id}`,
              filePath: path,
              fragmentSize: that.CHUNK_SIZE,
              fileName: name,
              fileHash: hash ? hash : '',
              upLoadFragmentIndex: index ? index : '',
              channelId: id,
              headerData: {
                sign: sign,
                userId: userId,
                type: '1',
                timestamp: timestamp,
                Authentication: Authentication,
              }
            },
          }, function (res) {
            if (res.err_msg.endsWith(":ok")) { //成功结果
              //上传完成
              that.recording(id)
            } else if (res.err_msg.endsWith(":cancel")) {
              that.cleanData();
              return
            } else {
              //上传失败
              if (that.myindex != Number(res.upLoadFragmentIndex)) {
                that.myindex = Number(res.upLoadFragmentIndex);
                that.retryNum = 0;
              }
              setTimeout(() => {
                if (that.retryNum > 4) {
                  // that.retryNum = 0
                  var btnArray = ["取消", "确定"];
                  var i = 0
                  mui.confirm(
                    "是否进行重试？",
                    "上传失败",
                    btnArray,
                    (e) => {
                      if (i > 0) return
                      i++
                      if (e.index == 1) {
                        that.checkList(path, name, id, res.fileHash, res.upLoadFragmentIndex)
                      } else {
                        that.cleanData()
                      }
                    }
                  );
                } else {
                  that.retryNum++

                  that.checkList(path, name, id, res.fileHash, res.upLoadFragmentIndex)
                }

              }, (that.retryNum + 1) * 1000)

            }
          })
        },
        cleanData() {
          this.disabledInp = false
          this.progressBar = false
        },
        createNonceStr(len) {
          var e = len ? len : 16;
          var t =
            "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
            a = t.length,
            n = "";
          for (i = 0; i < e; i++)
            n += t.charAt(Math.floor(Math.random() * a));
          return n;
        },
        // 传完了告知是哪个用户
        recording(id) {
          userId = sessionStorage.getItem("userId");
          unitId = sessionStorage.getItem("unitId");
          if (sessionStorage.getItem("iscp_port")) {
            iscp_port = sessionStorage.getItem("iscp_port");
          } else {
            iscp_port = ""
          }
          let data = {
            "id": id,
            "userId": userId,
            "unitId": unitId,
            "timestamp": new Date().getTime() + ""
          };
          data = JSON.stringify(data)
          let sign = sm3(data);
          let AuthenticationSession = sessionStorage.getItem("Authentication");
          $.ajax({
            url: localUrlLink + iscp_port + "/tjAiAssistant/IdentificationFile/addPdfToWord",
            type: "post",
            async: false,
            dataType: "json",
            data: data,
            headers: {
              "Content-Type": "application/json;charset=UTF-8",
              Authentication: AuthenticationSession,
              sign: sign
            },
            success: (res, txt, xhr) => {
              // $(".curtainVoice").css("display", "none");
              $(".curtain").css("display", "none");
              if (sm3(res.resultValueStr) == xhr.getResponseHeader("sign")) {
                let Authentication = xhr.getResponseHeader("Authentication")
                if (res.code == 200) {
                  if (Authentication) {
                    sessionStorage.setItem("Authentication", Authentication);
                    this.progress = 100
                    mui.toast('文档正在转换中，完成后发送邮箱', {
                      duration: 2000,
                      type: 'div'
                    })
                    // setTimeout(() => {
                    //   this.cleanData()
                    // }, 1500)
                  }
                } else if (res.code == 500) {
                  mui.toast(res.resultValue, {
                    duration: 'long',
                    type: 'div'
                  })
                } else {
                  mui.toast('请求异常,请稍后再试', {
                    duration: 'long',
                    type: 'div'
                  })
                }
              } else {
                mui.toast('完整性校验失败', {
                  duration: 'long',
                  type: 'div'
                })
              }
            },
            error: (e) => {
              // $(".curtainVoice").css("display", "none");
              $(".curtain").css("display", "none");
              mui.toast('请求异常,请稍后再试', {
                duration: 'long',
                type: 'div'
              })
            },
          });
        },
        // checkUpload(file, md5) {
        //   userId = sessionStorage.getItem("userId");
        //   if (sessionStorage.getItem("iscp_port")) {
        //     iscp_port = sessionStorage.getItem("iscp_port");
        //   } else {
        //     iscp_port = ""
        //   }
        //   var timestamp = new Date().getTime() + ""
        //   var me = this;
        //   let data = {
        //     md5: md5,
        //     size: file.size,
        //     fileName: file.name,
        //     userId: userId,
        //     timestamp: timestamp
        //   }
        //   data = JSON.stringify(data)
        //   let sign = sm3(data);
        //   let AuthenticationSession = sessionStorage.getItem("Authentication");
        //   $.ajax({
        //     // url: 'http://172.23.6.149:18091' + "/tjAiAssistant/storage/checkFile",
        //     url: localUrlLink + iscp_port + "/tjAiAssistant/storage/checkFile",
        //     type: "post",
        //     data: data,
        //     async: false, //是否同步，false表示同步请求
        //     dataType: "json",
        //     headers: {
        //       "Content-Type": "application/json;charset=UTF-8",
        //       Authentication: AuthenticationSession,
        //       sign: sign,
        //       timestamp: timestamp
        //     },
        //     success: function (res, txt, xhr) {
        //       if (sm3(res.resultValueStr) == xhr.getResponseHeader("sign")) {
        //         let Authentication = xhr.getResponseHeader("Authentication")
        //         if (res.code == 200) {

        //           if (Authentication) {
        //             sessionStorage.setItem("Authentication", Authentication);
        //             me.progress = 0
        //             if (res.resultValue.status == 1) {
        //               me.disabledInp = false
        //               me.recording(res.resultValue.id)
        //               return;
        //             }
        //             me.progressBar = true
        //             // $(".curtainVoice").css("display", "block");
        //             if (res.resultValue.id && res.resultValue.status == 0) {
        //               if (res.resultValue.patchIndex == [] || res.resultValue.patchIndex.length == 0) {
        //                 me.upload(res.resultValue.id, file);
        //                 return
        //               }
        //               var shardCount = Math.ceil(file.size / me.CHUNK_SIZE);
        //               me.succeed = Number(res.resultValue.patchIndex)
        //               me.progress = me.speedFun(me.succeed, shardCount)
        //               me.upload(res.resultValue.id, file, Number(me.succeed) + 1);
        //               return;
        //             }
        //             me.upload(res.resultValue.id, file);
        //           }
        //         } else {
        //           $(".curtainVoice").css("display", "none");
        //           mui.toast('上传失败,请稍后再试', {
        //             duration: 'long',
        //             type: 'div'
        //           })
        //         }
        //       } else {
        //         // $(".curtainVoice").css("display", "none");
        //         mui.toast('完整性校验失败', {
        //           duration: 'long',
        //           type: 'div'
        //         })
        //       }
        //     },
        //     error: function (XMLHttpRequest, textStatus, errorThrown) {
        //       // $(".curtainVoice").css("display", "none")
        //       mui.toast('请求异常,请稍后再试', {
        //         duration: 1000,
        //         type: 'div'
        //       })
        //     },
        //   });
        // },

        // /**
        //  * 上传分片文件
        //  * @param parent //id
        //  * @param file
        //  * @param index
        //  * @param shardCount
        //  */
        // uploadPatch(parent, file, index, shardCount, next) {
        //   let _this = this;
        //   var start = index * _this.CHUNK_SIZE;
        //   var end = Math.min(file.size, start + _this.CHUNK_SIZE);
        //   if (index == shardCount - 2) {
        //     var start = index * _this.CHUNK_SIZE;
        //     var end = file.size;
        //   }
        //   var patch = file.slice(start, end);
        //   var spark = new SparkMD5();
        //   let userId = sessionStorage.getItem("userId");
        //   var reader = new FileReader();
        //   reader.readAsBinaryString(patch);
        //   reader.onload = function (e) {
        //     var timestamp = new Date().getTime() + ""
        //     var sign = sm3(timestamp + "&" + userId)
        //     let AuthenticationSession = sessionStorage.getItem("Authentication");
        //     spark.appendBinary(e.target.result);
        //     var md5 = spark.end();
        //     var form = new FormData();
        //     form.append("index", index);
        //     form.append("parent", parent);
        //     form.append("md5", md5);
        //     form.append("size", patch.size);
        //     form.append("patch", patch);
        //     form.append("name", file.name + "-patch-" + index);
        //     $.ajax({
        //       url: localUrlLink + iscp_port + "/tjAiAssistant/storage/splitUpload",
        //       // url: 'http://172.23.6.149:18091' + "/tjAiAssistant/storage/splitUpload",
        //       type: "post",
        //       data: form,
        //       processData: false,
        //       contentType: false,
        //       // dataType: "json",
        //       headers: {
        //         Authentication: AuthenticationSession,
        //         sign: sign,
        //         userId: userId,
        //         timestamp: timestamp
        //       },
        //       success: function (res) {
        //         if (res.code == 200) {
        //           _this.succeed = Number(_this.succeed) + 1
        //           _this.progress = _this.speedFun(_this.succeed, shardCount)
        //           if (next) {
        //             next('success', index, true)
        //           }
        //           if (_this.progress == 100) {
        //             setTimeout(() => {
        //               _this.determine()
        //             }, 1500)
        //             _this.recording(parent)
        //           }
        //           console.log("上传分片" + index + "成功！");
        //         } else {
        //           // $(".curtainVoice").css("display", "none")
        //           var btnArray = ["取消", "确定"];
        //           var i = 0
        //           mui.confirm(
        //             "是否进行重试？",
        //             "上传失败",
        //             btnArray,
        //             (e) => {
        //               if (i > 0) return
        //               i++
        //               if (e.index == 1) {
        //                 if (next) {
        //                   next('false', index, false)
        //                 }
        //               } else {
        //                 _this.determine()

        //               }
        //             }
        //           );

        //           return;
        //         }
        //       },
        //       error: function (XMLHttpRequest, textStatus, errorThrown) {
        //         // $(".curtainVoice").css("display", "none")
        //         var btnArray = ["取消", "确定"];
        //         var i = 0
        //         mui.confirm(
        //           "是否进行重试？",
        //           "上传失败",
        //           btnArray,
        //           (e) => {
        //             if (i > 0) return
        //             i++
        //             if (e.index == 1) {
        //               // $(".curtainVoice").css("display", "block");
        //               if (next) {
        //                 next('false', index, false)
        //               }
        //             } else {
        //               _this.determine()
        //             }
        //           }
        //         );

        //         return;
        //       },
        //     });
        //   };
        // },
        // determine() {
        //   this.disabledInp = false
        //   this.succeed = []

        //   this.progressBar = false
        //   this.progress = 0
        // },

      },
    })
  </script>
</body>

</html>